package com.ruoyi.web.controller.business.audit;

import com.ruoyi.business.base.PageParam;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.controller.business.audit.factory.JbAuditFactory;
import com.ruoyi.web.controller.business.order.vo.JbAuditVO;
import com.ruoyi.web.controller.business.order.vo.JbOrderVO;
import com.ruoyi.web.core.JoController;
import com.ruoyi.web.core.JoR;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 审批 控制类
 *
 * @author Jyl
 */
@RestController
@RequestMapping("/audit")
public class JbAuditController extends JoController
{
    @Autowired
    private JbAuditFactory jbAuditFactory;

    /**
     * 审批
     */
    @ApiOperation("审批")
    @PostMapping()
    public AjaxResult audit(@RequestBody JbAuditVO jbAuditVO)
    {
        return JoR.success(jbAuditFactory.audit(jbAuditVO));
    }

    /**
     * 撤销审批
     */
    @ApiOperation("撤销")
    @PutMapping("/revoke")
    public AjaxResult revoke(@RequestBody JbOrderVO jbOrderVO)
    {
        return JoR.success(jbAuditFactory.revoke(jbOrderVO.getId()));
    }

    /**
     * 查询订单列表
     */
    @ApiOperation("查询订单列表")
    @GetMapping("/orderList")
    public AjaxResult orderList(PageParam param, String auditStatus)
    {
        return JoR.success(jbAuditFactory.orderTask(param));
    }

    /**
     * 查询回款列表
     */
    @ApiOperation("查询回款列表")
    @GetMapping("/paymentReceivedList")
    public AjaxResult paymentReceivedList(PageParam param, String auditStatus)
    {
        return JoR.success(jbAuditFactory.paymentTask(param));
    }

    /**
     * 查询退款退货列表
     */
    @ApiOperation("查询退款退货列表")
    @GetMapping("/refundList")
    public AjaxResult refundList(PageParam param, String auditStatus)
    {
        return JoR.success(jbAuditFactory.refundTask(param));
    }
}
